﻿#pragma once


#include <QDialog>
#include <QPushButton>
#include "QListView"
#include "QStringListModel"
#include "QFileDialog"
#include "QMessageBox"
#include "QApplication"
#include "QVBoxLayout"
#include <QDesktopWidget>
#include <QLibrary>
#include <QApplication>
#include <QLabel>
#include <QComboBox>
#include "QListView"
#include "QStringListModel"
#include "QLineEdit"
#include "QSpinBox"
#include <QSettings>

#include "commonfunction.h"

#include "halcon_opencv.h"

using namespace std;

#include "qt_graphics_view_image.h"
#include "qt_graphics_shape_rectangle.h"


class FunctionWidthMeasure :public QDialog
{
public:
    QSettings* m_qsettings;
    Mat m_image ,m_image_show;
    QString m_section   = "";

    MyQGraphicsView* m_view ;


   /* QLabel* m_qlabel_detection_count;
    QSpinBox* m_qspinbox_detection_count;*/
	//int m_detection_count = 1;

	QLabel* m_qlabel_1_min;
	QSpinBox* m_qspinbox_1_min;
	int m_1_min = 0;

	QLabel* m_qlabel_1_max;
	QSpinBox* m_qspinbox_1_max;
	int m_1_max = 10000;

	/*QLabel* m_qlabel_2_min;
	QSpinBox* m_qspinbox_2_min;
	int m_2_min = 0;

	QLabel* m_qlabel_2_max;
	QSpinBox* m_qspinbox_2_max;
	int m_2_max = 10000;

	QLabel* m_qlabel_3_min;
	QSpinBox* m_qspinbox_3_min;
	int m_3_min = 0;

	QLabel* m_qlabel_3_max;
	QSpinBox* m_qspinbox_3_max;
	int m_3_max = 10000;

	QLabel* m_qlabel_4_min;
    QSpinBox* m_qspinbox_4_min;
    int m_4_min=0;

    QLabel* m_qlabel_4_max;
    QSpinBox* m_qspinbox_4_max;
    int m_4_max=10000;*/

	QPushButton* m_pushbutton_show_orign_image;
    QPushButton* m_pushbutton_detection;
    QPushButton* m_pushbutton_save_parameter;
    QPushButton* m_pushbutton_return;

    QLabel* m_qlabel_message;

    int m_result;




	HObject m_region_show;

	double value_standard=0;

    HObject image_in;

    

public:
    explicit FunctionWidthMeasure(QDialog *parent = nullptr, QSettings* qsettings = nullptr,QString section="") ;
    ~FunctionWidthMeasure() ;
    virtual void detectionImage();
    virtual bool detection( HObject image_in, QString& message);
    virtual void draw( Mat image_in,Mat& image_out);
    virtual void loadParameter();
    virtual void saveParameter();
    virtual bool showDialog();
};
#pragma execution_character_set("utf-8")
